package il.ac.braude.sona.IcmUnitTest;

import il.ac.braude.sona.constants.TestingParamKit;
import il.ac.braude.sona.gui.SONAFrame;
import il.ac.braude.sona.ocsf.client.ConnectToClientForTesting;

import java.util.ArrayList;

import javax.swing.JDialog;
import javax.swing.JOptionPane;

import junit.framework.Test;
import junit.framework.TestSuite;

public class AllTests {
	public static ConnectToClientForTesting connection= new ConnectToClientForTesting();
	private static TestingParamKit TestKit=TestingParamKit.getTestingKit();
	public static Test suite() {
		showTestingMessage();
		TestKit.startTestMode();
		connection.setHost("localhost");
		ArrayList<Object> values=new ArrayList<Object>();
		values.add("avihay");
		values.add("1234");
		connection.connectToClient(values);
		TestSuite suite = new TestSuite(AllTests.class.getName());
		//$JUnit-BEGIN$
		suite.addTestSuite(ActiveStdUnitTest.class);
		suite.addTestSuite(FrozenMedianTest.class);
		//$JUnit-END$
		return suite;
	}
	private static void showTestingMessage(){
		SONAFrame frame = null;
		JDialog dialog = new JDialog(frame, false); // Sets its owner but makes it non-modal 
		JOptionPane optionPane = new JOptionPane("Please dont press on poped windows, wait until test finish"); // Same arguments as in JOptionPane.showMessageDialog(...)
		dialog.getContentPane().add(optionPane); // Adds the JOptionPane to the dialog
		dialog.pack(); // Packs the dialog so that the JOptionPane can be seen
		dialog.setVisible(true); // Shows the dialog
	}

}
